<template>
  <div class="feedback-form">
    <h2>具体问题和意见</h2>
    <form @submit.prevent="submitForm">
      <div class="form-group">
        <label for="issue">写下您在使用过程中遇到的具体问题或意见：</label>
        <textarea id="issue" v-model="form.issue" required></textarea>
      </div>

      <div class="form-group">
        <label for="screenshot">提供问题截图或照片：</label>
        <input type="file" id="screenshot" @change="handleFileUpload" accept="image/*" />
      </div>

      <div class="form-group">
        <label for="phone">联系方式：</label>
        <input type="tel" id="phone" v-model="form.phone" placeholder="请输入手机号" required />
      </div>

      <button type="submit">提交</button>
    </form>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const form = ref({
  issue: '',
  screenshot: null,
  phone: ''
});

const handleFileUpload = (event) => {
  form.value.screenshot = event.target.files[0];
};

const submitForm = () => {
  console.log('Form submitted:', form.value);
};
</script>

<style scoped>
.feedback-form {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
}

textarea, input[type="tel"], input[type="file"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  padding: 10px 15px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
}
</style>
